<?PHP
include_once("include/class.db.php5");
$db = new db("svoptik");

$sql = $db->doSQL("SELECT MemberName,MemberVName, MemberGebDat FROM svoptik_member");
$gruss = "Die Red Eagles gratulieren ";
$bdayTrue = 0;

while($erg = mysql_fetch_array($sql)) {
  $vergleich = substr($erg["MemberGebDat"],5);

  if ($vergleich == date("m-d")) {
   	$alter = date("Y") - substr($erg["MemberGebDat"],0,6);

	if ($bdayTrue) {
	  		$gruss = $gruss ." &";
  	}

	$gruss = $gruss . " " . $erg["MemberVName"] . " " . $erg["MemberName"] . " (" . $alter . ")";

  	$bdayTrue = 1;
  }
}
$gruss = $gruss . " zum Geburtstag!";
?>